const jsonServer = require('json-server')
const server = jsonServer.create()
const db = require('./db')
const middlewares = jsonServer.defaults()
server.use(middlewares)

server.use(jsonServer.rewriter({
    '/api/park/index/weather': '/weather',

    '/api/park/index/getJamData': '/getJamData',
    '/api/park/index/getAreaHotspot': '/getAreaHotspot',
    '/api/park/index/getJameStreet': '/getJameStreet',
    '/api/park/index/getChargingPile': '/getChargingPile',
    '/api/park/index/getCarRate': '/getCarRate',
    '/api/park/index/getBikeData': '/getBikeData',
    '/api/park/index/getRegionCarRate': '/getRegionCarRate',
    '/api/park/index/getMiddleTotalData': '/getMiddleTotalData',
    '/api/park/index/getTotalResourceData': '/getTotalResourceData',

    '/api/park/index/getAdminData': '/getAdminData',
    '/api/park/index/getAllRoadData': '/getAllRoadData',
    '/api/park/index/getTotalInfo': '/getTotalInfo',
    '/api/park/index/getMixRoadData': '/getMixRoadData',
    '/api/park/index/getParkingTime': '/getParkingTime',
    '/api/park/index/getMapLine': '/getMapLine',
    '/api/park/index/getParkingWarning': '/getParkingWarning',
    '/api/park/index/getAllRegionData': '/getAllRegionData',
    '/api/park/index/getOweFeeRate': '/getOweFeeRate',
    '/api/park/index/getAdminPhone': '/getAdminPhone',
    '/api/park/index/statisticsTotalData': '/statisticsTotalData',

    '/api/park/index/getOrderParkInfo': '/getOrderParkInfo',
    '/api/park/index/getCarParkNum': '/getCarParkNum',
    '/api/park/index/getFiveZoneNum': '/getFiveZoneNum',
    '/api/park/index/getChargingType': '/getChargingType',
    '/api/park/index/getDeviceInfo': '/getDeviceInfo',
    '/api/park/index/markParkPoint': '/markParkPoint',
    '/api/park/index/getImgList': '/getImgList',
    '/api/park/index/getPromotionalVideo': '/getPromotionalVideo',
    '/api/park/index/statisticsParkData': '/statisticsParkData',

    '/api/park/index/getMixChargingInfo': '/getMixChargingInfo',
    '/api/park/index/chargingPileRate': '/chargingPileRate',
    '/api/park/index/getPowerConsumptionPerWeek': '/getPowerConsumptionPerWeek',
    '/api/park/index/getMerchantShareCarNum': '/getMerchantShareCarNum',
    '/api/park/index/getDeviceData': '/getDeviceData',
    '/api/park/index/getOperationalWorkOrder': '/getOperationalWorkOrder',
    '/api/park/index/getChargingPileNeed': '/getChargingPileNeed',
    '/api/park/index/getChargingPileType': '/getChargingPileType',
    '/api/park/index/getChargingHotSpot': '/getChargingHotSpot',

    '/api/park/index/getBikeNum': '/getBikeNum',
    '/api/park/index/getBikeRegNum': '/getBikeRegNum',
    '/api/park/index/getBikePutinRate': '/getBikePutinRate',
    '/api/park/index/getRegionBikeNum': '/getRegionBikeNum',
    '/api/park/index/getBreakageRate': '/getBreakageRate',
    '/api/park/index/getUseRate': '/getUseRate',
    '/api/park/index/biekeMark': '/biekeMark',
    '/api/park/index/getCheckPointNum': '/getCheckPointNum',

    '/api/park/index/HotSpotList': '/HotSpotList',
    '/api/park/index/ViolationOfStatistics': '/ViolationOfStatistics',
    '/api/park/index/getAdminValationList': '/getAdminValationList',
    '/api/park/index/searchInfo': '/searchInfo',
    '/api/park/index/dishonest': '/dishonest',
    '/api/park/index/complaint': '/complaint',
    '/api/park/index/complaintType': '/complaintType',
    '/api/park/index/getHotspotImg': '/getHotspotImg',


    '/api/park/index/parkState': '/parkState',
    '/api/park/index/carportShared': '/carportShared',
    '/api/park/index/getTotalInfoData': '/getTotalInfoData',
    '/api/park/index/getCarInfo': '/getCarInfo',
    '/api/park/index/patrolLinkage': '/patrolLinkage',
    '/api/park/index/parkBooking': '/parkBooking',
    '/api/park/index/OldCommunityRemould': '/OldCommunityRemould',
    '/api/park/index/getZhianTotalData': '/getZhianTotalData',
    '/api/park/index/getCarParkState': '/getCarParkState'

}))

server.use(jsonServer.router(db))
server.listen(3000, () => {
    console.log('JSON Server is running')
})
